<?php
require_once("kra_base.php");

class yaba extends kra_base {
    private $format = 'json';
    public function __construct($api_key = "", $api_secret = "", $app_id = 0)
		{
		$this->_api_key = $api_key;
		$this->_api_secret = $api_secret;
		$this->_app_id = $app_id;
		//$this->_rest_url = 'http://app.mbga-platform.jp/social/api/restful/v2';
		$this->_rest_url = 'http://app.sb.mbga-platform.jp/social/api/restful/v2';
    }

    public function __destruct() {
	
    }

    public function getblacklist($uid = 0, $fuid = 0)
	{
		$url = "{$this->_rest_url}/blacklist/{$uid}/@all/{$fuid}";
		$consumer = new OAuthConsumer($this->_api_key, $this->_api_secret, null);
		parse_str(parse_url($url, PHP_URL_QUERY), $params);
		$request = OAuthRequest::from_consumer_and_token($consumer, null, "GET", $url, $params);
		$request->sign_request(new OAuthSignatureMethod_HMAC_SHA1(), $consumer, null);
		$auth_header = $request->to_header();

		$ch = curl_init($url);
	    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	    curl_setopt($ch, CURLOPT_FAILONERROR, false);
	    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	    curl_setopt($ch, CURLOPT_ENCODING, "gzip");
	    curl_setopt($ch, CURLOPT_HTTPHEADER, array($auth_header));
	    $result = curl_exec($ch);
	    curl_close($ch);

		$ret = @json_decode($result, true);

		if(!$ret) return false;
		if(!$ret["id"] || !$ret["targetId"]) return false;

		return true;
    }

}

?>
